# Dockerfile for apollo-configservice
# Build with:
# docker build -t apollo-configservice .
# Run with:
# docker run -p 8091:8091 -d -v /tmp/logs:/opt/logs --name apollo-configservice apollo-configservice

#FROM openjdk:8-jre-alpine
#MAINTAINER ameizi <sxyx2008@163.com>

#ENV VERSION 0.11.1-SNAPSHOT

#RUN echo "http://mirrors.aliyun.com/alpine/v3.6/main" > /etc/apk/repositories \
#    && echo "http://mirrors.aliyun.com/alpine/v3.6/community" >> /etc/apk/repositories \
#    && apk update upgrade \
#    && apk add --no-cache procps unzip curl bash tzdata \
#    && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
#    && echo "Asia/Shanghai" > /etc/timezone

#    ADD apollo-configservice-${VERSION}-github.zip /apollo-configservice/apollo-configservice-${VERSION}-github.zip

#RUN unzip /apollo-configservice/apollo-configservice-${VERSION}-github.zip -d /apollo-configservice \
#    && rm -rf /apollo-configservice/apollo-configservice-${VERSION}-github.zip \
#    && sed -i '$d' /apollo-configservice/scripts/startup.sh \
#    && echo "tail -f /dev/null" >> /apollo-configservice/scripts/startup.sh

#EXPOSE 8091

#CMD ["/apollo-configservice/scripts/startup.sh"]

FROM java:alpine
MAINTAINER gongjing <jsjgongjing@sina.com>
#设置时区
RUN echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories \
    && echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories \
    && apk update upgrade \
    && apk add --no-cache openssh  vim \
    && apk add --no-cache procps unzip curl bash tzdata \
    && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && echo "Asia/Shanghai" > /etc/timezone
RUN set -x \
    && apk add --no-cache busybox-extras
WORKDIR /app
COPY apollo-configservice-0.11.1-SNAPSHOT.jar /app
ENV JAVA_OPT=${JAVA_OPTS}
ENV JVM_SERVER_FIXED_ARGS=${JVM_SERVER_FIXED_ARGS}
ENV JVM_GC_LOG_PATH=${JVM_GC_LOG_PATH}
EXPOSE 8091
ENTRYPOINT java ${JAVA_OPTS} ${JVM_SERVER_FIXED_ARGS} ${JVM_GC_LOG_PATH}\
  -Djava.security.egd=file:/dev/./urandom -Dfile.endcoding=UTF-8 -jar /app/apollo-configservice-0.11.1-SNAPSHOT.jar\
  --spring.config.location=/app/apollo-env.properties
